using Unity.Entities;
using Unity.Mathematics;
using UnityEngine;

namespace DOTS.DOD.LESSON0
{
    struct RotateSpeed : IComponentData
    {
        public float Value;
    }

    public class RotateSpeedAuthoring : MonoBehaviour
    {
        [Range(0, 360)] public float RotateSpeed;

        public class Baker : Baker<RotateSpeedAuthoring>
        {
            public override void Bake(RotateSpeedAuthoring authoring)
            {
                var entity = GetEntity(TransformUsageFlags.None);
                AddComponent(entity, new RotateSpeed()
                {
                    Value = math.radians(authoring.RotateSpeed),
                });
            }
        }
    }
}